<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<%@include file="/WEB-INF/taglibs/common/taglibs.jsp"%>
<head>
<title><spring:message code="admin.editlicense.title" /></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link rel="stylesheet" href="<c:url value="/css/styles.css"/>" />
<script src="<c:url value="/javascripts/common.js"/>"></script>

<script language="javascript" type="text/javascript">
function deleteFile()
{
  document.getElementById('licenseForm').deleteFile.value = "true";
  document.getElementById('delAttachment').style.display = 'none';
  document.getElementById('addAttachment').style.display = 'inline';
  
}

function download( id ){
	document.location.href = "download_license.htm?id="+id;
}

function initPage(){
	var attachmentSize = ${fn:length(licenseForm.license.attachments)};
	if(attachmentSize>0)
	  {
		document.getElementById('delAttachment').style.display = 'inline';
		document.getElementById('addAttachment').style.display = 'none'; 
	  }
	else
      {
		document.getElementById('delAttachment').style.display = 'none';
		document.getElementById('addAttachment').style.display = 'inline';
	  }  
	
} 
</script>
</head>
<body onload="initPage();">
<%@include file="../top_menu.jsp"%>
<table width=100%>
	<tr>
		<td><c:import url="/WEB-INF/jsp/menu/admin_license_menu.jsp" /></td>
	</tr>
	<tr>
		<td><%@include file="/WEB-INF/jsp/include/messages.jsp"%>
		<br />
		</td>
	</tr>
</table>

<form:form commandName="licenseForm" method="post"
	enctype="multipart/form-data">

	<table width=70% class="formTable">

		<tr class="formHeader">
			<td width="18%" colspan="2" align="left"><br />
			<spring:message code="admin.editlicense.label.editlicense" /></td>
		</tr>

		<tr bgcolor="#FFFFFF">
			<td width="18%"><spring:message code="admin.editlicense.label.licensename" /></td>
			<td width="80%"><form:hidden path="license.id" /><form:input
				path="license.name" size="30" readonly="false" /></td>
		</tr>

		<tr bgcolor="#FFFFFF">
			<td width="18%"><spring:message code="admin.editlicense.label.text" /></td>
			<td width="80%"><form:textarea path="license.text" rows="5"
				cols="50" readonly="false" /></td>
		</tr>

		<tr bgcolor="#FFFFFF">
			<td width="18%"><spring:message code="admin.editlicense.label.comments" /></td>
			<td width="80%"><form:input path="license.comments" size="30"
				readonly="false" /></td>
		</tr>

		<tr bgcolor="#FFFFFF">
			<td width="18%"><spring:message code="admin.editlicense.label.active" /></td>
			<td width="80%"><form:checkbox path="license.active" /></td>
		</tr>


		<tr bgcolor="#FFFFFF">
			<td width="18%"><spring:message code="admin.editlicense.label.attachements" /></td>
			<td width="80%">
			<div id="addAttachment" style="display: none"><input
				type="file" name="file" /></div>
			<div id="delAttachment" style="display: none"><a
				href="javascript:download(${licenseForm.license.id});"><spring:message code="admin.editlicense.label.download" />
			${licenseForm.license.filename}</a> | <a href="javascript:deleteFile();"><spring:message code="admin.editlicense.label.removefile" />
			</a><input type="hidden" name="deleteFile" value="false" /></div>
			</td>
		</tr>
		<tr>
			<td><input type="submit" class='ui-button ui-state-default ui-corner-all' value="<spring:message code="admin.createlicense.button.updatelicense" />" /></td>
		</tr>

	</table>

</form:form>
<%@include file="/WEB-INF/jsp/include/footer.jsp"%>
</body>
</html>